package com.movie2.service.impl;

import com.movie2.model.entity.Message;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import com.movie2.mapper.MessageMapper;
import com.movie2.service.MessageService;


/**
 * 
 * MessageService业务逻辑操作接口类的实现类
 * 
 **/

@Service
@Transactional
@Slf4j
public class MessageServiceImpl implements MessageService{

	@Autowired
	MessageMapper messageMapper;

	//查询（根据主键ID查询）
	public Message  selectByPrimaryKey (Integer id){
		log.info("通过主键查询Message信息:selectByPrimaryKey() ");
		return messageMapper.selectByPrimaryKey(id);
	}

	//查询（获得数据表中的数量）
	public int selectMessageCount(){
		log.info("获得Message数量信息:selectMessageCount() ");
		return messageMapper.selectMessageCount();
	}

	//查询全部信息
	public List<Message>  selectAllMessages ( ){
		log.info("获得全部Message信息:selectAllMessages() ");
		return messageMapper.selectAllMessages ( );
	}

	//查询（根据其他条件查询需要的结果）

	public int selectMessagesCountByCondition(Map<String,Object> map){
		log.info("根据其他条件查询需要的Message信息:selectMessagesCountByCondition() ");
		return messageMapper.selectMessagesCountByCondition(map);
	}

	//查询（通过Map条件，获得所有符合的信息）

	public List<Message> selectMessagesCondition(Map<String,Object> map){
		log.info("根据其他条件查询需要的Message信息:selectMessagesCountByCondition() ");
		return messageMapper.selectMessagesCondition(map);
	}

	//查询（通过条件进行分页查询）

	public List<Message> selectMessagesPerPageByCondition(Map<String,Object> map){
		log.info("通过条件进行分页查询Message信息:selectMessagesPerPageByCondition() ");
		return messageMapper.selectMessagesPerPageByCondition(map);
	}

	//条件查询
	public List<Message>  selectMessagesByCondition (Message record){
		log.info("通过传入的参数条件Message信息进行查询:selectMessagesByCondition () ");
		return messageMapper.selectMessagesByCondition(record);
	}

	//删除（条件删除）
	public int deleteByCondition( Message record ){
		log.info("根据传入的Message信息，条件删除:deleteByCondition() ");
		return messageMapper.deleteByCondition(record);
	}

	//删除（根据主键ID删除）
	public int deleteByPrimaryKey (Integer id ){
		log.info("主键ID删除Message信息:deleteByPrimaryKey() ");
		return messageMapper.deleteByPrimaryKey(id);
	}

	//添加
	public int insert( Message record ){
		log.info("新增Message信息:insert() ");
		return messageMapper.insert(record);
	}

	//添加 （匹配有值的字段）
	public int insertSelective( Message record ){
		log.info("新增（匹配有值的字段）Message信息:insertSelective() ");
		return messageMapper.insertSelective(record);
	}

	//修改 （匹配有值的字段）
	public int updateByPrimaryKeySelective( Message record ){
		log.info("修改（匹配有值的字段）Message信息:updateByPrimaryKeySelective() ");
		return messageMapper.updateByPrimaryKeySelective(record);
	}

	//修改（根据主键ID修改）
	public int updateByPrimaryKey ( Message record ){
		log.info("修改Message信息:updateByPrimaryKey() ");
		return messageMapper.updateByPrimaryKey(record);
	}

}